﻿<Fluent:RibbonWindow x:Class="UI.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:ad="clr-namespace:AvalonDock;assembly=AvalonDock"
    xmlns:controls="clr-namespace:UI.Controls"
    xmlns:cal="http://www.codeplex.com/CompositeWPF"
    xmlns:Fluent="clr-namespace:Fluent;assembly=Fluent"
    Title="Book Cataloger" 
    Height="600" Width="800"
    Closing="Window_Closing"
    Loaded="Window_Loaded">
	<Window.Resources>
		<DataTemplate x:Key="WindowDataTemplate">
			<StackPanel>
				<TextBlock Text="{Binding Title}" />
			</StackPanel>
		</DataTemplate>
	</Window.Resources>
    <DockPanel >
        <Fluent:Ribbon x:Name="Ribbon" DockPanel.Dock="Top">
            <!-- Backstage -->
            <Fluent:Ribbon.BackstageItems>
                <Fluent:BackstageTabItem Header="New">
                    <ListBox>
                            <Fluent:Button Grid.Row="0" 
                                           Name="ApplicationNewBook" 
                                           Text="Book"
                                           Icon="/Infrastructure;component/Images/Library.png"
                                           Click="RibbonCommand_NewBook"/>
                            <Fluent:Button Grid.Row="1" 
                                           Name="ApplicationNewJournal" 
                                           Text="Journal"
                                           IsEnabled="False"/>
                            <Fluent:Button Grid.Row="2" 
                                           Name="ApplicationNewThesis" 
                                           Text="Thesis"
                                           IsEnabled="False"/>
                    </ListBox>
                </Fluent:BackstageTabItem>
                <Fluent:Button Text="Open"
                               Icon="/Infrastructure;component/Images/toggle_log.png"
                               LargeIcon="/Infrastructure;component/Images/toggle_log.png"
                               Click="OpenBookshelf_Executed"/>
                <Fluent:Button Name="ApplicationCloseBookshelf" 
                               Text="Close"
                               Icon="/Infrastructure;component/Images/emblem-library.png"
                               LargeIcon="/Infrastructure;component/Images/emblem-library.png"
                               Click="RibbonCommand_Close"/>
               
                <Fluent:BackstageTabItem Header="Print" />
                <Fluent:BackstageTabItem Name="ExportMenu" 
                                         Header="Export"
                                         IsEnabled="False">
                    <ListBox Name="ExportList" />
                </Fluent:BackstageTabItem>

                <Fluent:Button Text="Options"
                               Click="RibbonCommand_Options"/>
                <Fluent:Button Text="Exit"
                               Click="RibbonCommand_ExitApplication"/>
            </Fluent:Ribbon.BackstageItems>
            
            <!-- Ribbon menu -->
            <Fluent:RibbonTabItem Header="Home">
                <Fluent:RibbonGroupBox Header="Bookshelf">
                    <Fluent:Button Name="HomeOpenBookshelf" 
                                   Text="Open" 
                                   Icon="/Infrastructure;component/Images/toggle_log.png"
                                   LargeIcon="/Infrastructure;component/Images/toggle_log.png"
                                   Click="OpenBookshelf_Executed"
                                   Fluent:KeyTip.Keys="O" >
                        <Fluent:Button.ToolTip>
                            <Fluent:ScreenTip Title="Open bookshelf"
                                              Text="Opens an existing bookshelf." />
                        </Fluent:Button.ToolTip>
                    </Fluent:Button>
                    <Fluent:Button Name="HomeNewBookshelf" 
                                   Text="New"
                                   Icon="/Infrastructure;component/Images/bookcase.png"
                                   LargeIcon="/Infrastructure;component/Images/bookcase.png" 
                                   SizeDefinition="Middle, Small, Small"
                                   Click="NewBookshelf_Executed"
                                   Fluent:KeyTip.Keys="NB">
                        <Fluent:Button.ToolTip>
                            <Fluent:ScreenTip Title="New bookshelf"
                                              Text="Creates a new bookshelf." />
                        </Fluent:Button.ToolTip>
                    </Fluent:Button>
                    <Fluent:Button Name="HomeCloseBookshelf" 
                                   Text="Close"
                                   Icon="/Infrastructure;component/Images/emblem-library.png" 
                                   LargeIcon="/Infrastructure;component/Images/emblem-library.png"
                                   SizeDefinition="Middle, Small, Small"
                                   Click="RibbonCommand_Close"
                                   Fluent:KeyTip.Keys="C">
                        <Fluent:Button.ToolTip>
                            <Fluent:ScreenTip Title="Close bookshelf"
                                              Text="Unloads the current bookshelf."
                                              DisableReason="No opened bookshelf."/>
                        </Fluent:Button.ToolTip>
                    </Fluent:Button>
                </Fluent:RibbonGroupBox>
                <Fluent:RibbonGroupBox Header="Document">
                    <Fluent:Button Name="HomeNewBook" 
                                   Text="Book"
                                   Icon="/Infrastructure;component/Images/Library.png" 
                                   LargeIcon="/Infrastructure;component/Images/Library.png"
                                   Click="RibbonCommand_NewBook"
                                   Fluent:KeyTip.Keys="N">
                        <Fluent:Button.ToolTip>
                            <Fluent:ScreenTip Title="New book"
                                              Text="Creates a new book."
                                              DisableReason="Create a new bookshelf or open an existing one to be able to create a book."/>
                        </Fluent:Button.ToolTip>
                    </Fluent:Button>
                    <Fluent:Button Name="HomeNewJournal" 
                                   Text="Journal"
                                   IsEnabled="False">
                        <Fluent:Button.ToolTip>
                            <Fluent:ScreenTip Title="New journal"
                                              Text="Creates a new journal."
                                              DisableReason="Not yet implemented."/>
                        </Fluent:Button.ToolTip>
                    </Fluent:Button>
                    <Fluent:Button Name="HomeNewThesis" 
                                   Text="Thesis"
                                   IsEnabled="False">
                        <Fluent:Button.ToolTip>
                            <Fluent:ScreenTip Title="New thesis"
                                              Text="Creates a new thesis."
                                              DisableReason="Not yet implemented."/>
                        </Fluent:Button.ToolTip>
                    </Fluent:Button>
                    <Fluent:Button Name="HomeEditDocument" 
                                   Text="Edit"
                                   Icon="/Infrastructure;component/Images/Rename.png"
                                   LargeIcon="/Infrastructure;component/Images/Rename.png"
                                   SizeDefinition="Middle, Small, Small"
                                   Click="EditDocumentCommand_Executed"
                                   Fluent:KeyTip.Keys="E">
                        <Fluent:Button.ToolTip>
                            <Fluent:ScreenTip Title="Edit book"
                                              Text="Edits the selected book's data."
                                              DisableReason="No book selected."/>
                        </Fluent:Button.ToolTip>
                    </Fluent:Button>
                    <Fluent:Button Name="HomeDeleteDocument" 
                                   Text="Delete"
                                   Icon="/Infrastructure;component/Images/delete.png"
                                   LargeIcon="/Infrastructure;component/Images/delete.png" 
                                   SizeDefinition="Middle, Small, Small"
                                   Click="DeleteDocumentCommand_Executed"
                                   Fluent:KeyTip.Keys="D">
                        <Fluent:Button.ToolTip>
                            <Fluent:ScreenTip Title="Delete book"
                                              Text="Deletes the selected book."
                                              DisableReason="No book selected."/>
                        </Fluent:Button.ToolTip>
                    </Fluent:Button>
                </Fluent:RibbonGroupBox>
                <Fluent:RibbonGroupBox Header="Help">
                    <Fluent:Button Name="HomeAbout" 
                                   Text="About"
                                   Icon="/Infrastructure;component/Images/help.png"
                                   LargeIcon="/Infrastructure;component/Images/help.png"
                                   Click="AboutCommand_Executed"
                                   Fluent:KeyTip.Keys="A">
                        <Fluent:Button.ToolTip>
                            <Fluent:ScreenTip Title="About"
                                              Text="Dipslays technical information about Book Cataloger."/>
                        </Fluent:Button.ToolTip>
                    </Fluent:Button>
                </Fluent:RibbonGroupBox>
            </Fluent:RibbonTabItem>
            <Fluent:RibbonTabItem Name="DictionariesTab" Header="Lists">
                <Fluent:RibbonGroupBox Header="List">
                    <Fluent:Button Name="ShowPublisherDictionary" 
                                   Text="Publisher"
                                   Click="RibbonCommand_Executed"
                                   Fluent:KeyTip.Keys="P">
                        <Fluent:Button.ToolTip>
                            <Fluent:ScreenTip Title="Publisher list"
                                              Text="Diplays the list of publishers. New publishers can be created or existing ones can be edited."
                                              Width="250"/>
                        </Fluent:Button.ToolTip>
                    </Fluent:Button>
                    <Fluent:Button Name="ShowBindingDictionary" 
                                   Text="Binding" 
                                   Click="RibbonCommand_Executed"
                                   Fluent:KeyTip.Keys="B">
                        <Fluent:Button.ToolTip>
                            <Fluent:ScreenTip Title="Binding list"
                                              Text="Diplays the list of bindings. New bindings can be created or existing ones can be edited."
                                              Width="250"/>
                        </Fluent:Button.ToolTip>
                    </Fluent:Button>
                    <Fluent:Button Name="ShowConditionDictionary" 
                                   Text="Condition" 
                                   Click="RibbonCommand_Executed"
                                   Fluent:KeyTip.Keys="C">
                        <Fluent:Button.ToolTip>
                            <Fluent:ScreenTip Title="Condition list"
                                              Text="Diplays the list of conditions. New conditions can be created or existing ones can be edited."
                                              Width="250"/>
                        </Fluent:Button.ToolTip>
                    </Fluent:Button>
                </Fluent:RibbonGroupBox>
            </Fluent:RibbonTabItem>
            <Fluent:RibbonTabItem Header="Layout">
                <Fluent:RibbonGroupBox Header="Presets">
                    <Fluent:Button Name="LayoutSaveLayout" 
                                   Text="Save"
                                   Click="SaveLayout_Executed"
                                   Fluent:KeyTip.Keys="S">
                        <Fluent:Button.ToolTip>
                            <Fluent:ScreenTip Title="Save layout"
                                              Text="Saves the current window layout which you can restore later."
                                              Width="250"/>
                        </Fluent:Button.ToolTip>
                    </Fluent:Button>
                    <ComboBox Name="LayoutSelector" 
                                     MinWidth="150" 
                                     Text="{Binding RelativeSource={RelativeSource Self}, Path=SelectedItem.Content}" />
                </Fluent:RibbonGroupBox>
                <Fluent:RibbonGroupBox Header="Windows">
                    <!--<ComboBox Name="WindowSelector" 
                                     MinWidth="150" 
                                     Text="{Binding RelativeSource={RelativeSource Self}, Path=SelectedItem.Content}" />-->
                    <Fluent:InRibbonGallery Name="WindowRibbonGallery"
                                            MinItemsInRow="1"
                                            MaxItemsInRow="5"
                                            >
                        
                    </Fluent:InRibbonGallery>
                </Fluent:RibbonGroupBox>
            </Fluent:RibbonTabItem>            
        </Fluent:Ribbon>
        <!-- End of Ribbon -->

        <StatusBar Name="statusbar" DockPanel.Dock="Bottom" Height="26">
            <StatusBarItem x:Name="LoadingStatus" Visibility="Collapsed">
                <StackPanel Orientation="Horizontal">
                    <TextBlock Name="LoadMessage" Text="Loading" Padding="0,0,5,0" />
                    <ProgressBar Name="LoadProgress" IsIndeterminate="True" Width="100" Height="17" />
                </StackPanel>
            </StatusBarItem>
        </StatusBar>
        <ad:DockingManager x:Name="dockManager" >
            <ad:ResizingPanel Name="_mainpanel" Orientation="Horizontal">

                <ad:DockablePane x:Name="_leftpane">
                    <ad:DockableContent x:Name="_books" Title="Books" DockableStyle="Dockable" >
                            <ContentControl x:Name="MainRegion" cal:RegionManager.RegionName="MainRegion" />
                    </ad:DockableContent>
                </ad:DockablePane>
                <ad:ResizingPanel x:Name="_verticalpane" Orientation="Vertical">
                    <ad:DockablePane x:Name="_toppane">
                        <ad:DockableContent x:Name="_details" Title="Details" DockableStyle="Dockable" >
                            <ContentControl x:Name="DetailsRegion" cal:RegionManager.RegionName="DetailsRegion" />                            
                        </ad:DockableContent>
                    </ad:DockablePane>
                    <ad:DockablePane x:Name="_bottompane">
                        <ad:DockableContent x:Name="_comments" Title="Comments" DockableStyle="Dockable" MinWidth="50" MinHeight="70">
                            <ContentControl x:Name="CommentEditorRegion" cal:RegionManager.RegionName="CommentEditorRegion" />
                        </ad:DockableContent>
                    </ad:DockablePane>
                </ad:ResizingPanel>
            </ad:ResizingPanel>
        </ad:DockingManager>
    </DockPanel>
</Fluent:RibbonWindow>
